3.6 \(\int \frac{\csc (x)}{a+b \sin (x)+c \sin ^2(x)} \, dx\)

Optimal. Leaf size=244 \[ -\frac{\sqrt{2} c \left (\frac{b}{\sqrt{b^2-4 a c}}+1\right ) \tan ^{-1}\left (\frac{\tan \left (\frac{x}{2}\right ) \left (b-\sqrt{b^2-4 a c}\right )+2 c}{\sqrt{2} \sqrt{-b \sqrt{b^2-4 a c}-2 c (a+c)+b^2}}\right )}{a \sqrt{-b \sqrt{b^2-4 a c}-2 c (a+c)+b^2}}-\frac{\sqrt{2} c \left (1-\frac{b}{\sqrt{b^2-4 a c}}\right ) \tan ^{-1}\left (\frac{\tan \left (\frac{x}{2}\right ) \left (\sqrt{b^2-4 a c}+b\right )+2 c}{\sqrt{2} \sqrt{b \sqrt{b^2-4 a c}-2 c (a+c)+b^2}}\right )}{a \sqrt{b \sqrt{b^2-4 a c}-2 c (a+c)+b^2}}-\frac{\tanh ^{-1}(\cos (x))}{a} \]

[Out]

-((Sqrt[2]*c*(1 + b/Sqrt[b^2 - 4*a*c])*ArcTan[(2*c + (b - Sqrt[b^2 - 4*a*c])*Tan[x/2])/(Sqrt[2]*Sqrt[b^2 - 2*c
*(a + c) - b*Sqrt[b^2 - 4*a*c]])])/(a*Sqrt[b^2 - 2*c*(a + c) - b*Sqrt[b^2 - 4*a*c]])) - (Sqrt[2]*c*(1 - b/Sqrt
[b^2 - 4*a*c])*ArcTan[(2*c + (b + Sqrt[b^2 - 4*a*c])*Tan[x/2])/(Sqrt[2]*Sqrt[b^2 - 2*c*(a + c) + b*Sqrt[b^2 -
4*a*c]])])/(a*Sqrt[b^2 - 2*c*(a + c) + b*Sqrt[b^2 - 4*a*c]]) - ArcTanh[Cos[x]]/a

________________________________________________________________________________________

Rubi [A]  time = 0.762139, antiderivative size = 244, normalized size of antiderivative = 1., number of steps used = 10, number of rules used = 6, integrand size = 17, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.353, Rules used = {3256, 3770, 3292, 2660, 618, 204} \[ -\frac{\sqrt{2} c \left (\frac{b}{\sqrt{b^2-4 a c}}+1\right ) \tan ^{-1}\left (\frac{\tan \left (\frac{x}{2}\right ) \left (b-\sqrt{b^2-4 a c}\right )+2 c}{\sqrt{2} \sqrt{-b \sqrt{b^2-4 a c}-2 c (a+c)+b^2}}\right )}{a \sqrt{-b \sqrt{b^2-4 a c}-2 c (a+c)+b^2}}-\frac{\sqrt{2} c \left (1-\frac{b}{\sqrt{b^2-4 a c}}\right ) \tan ^{-1}\left (\frac{\tan \left (\frac{x}{2}\right ) \left (\sqrt{b^2-4 a c}+b\right )+2 c}{\sqrt{2} \sqrt{b \sqrt{b^2-4 a c}-2 c (a+c)+b^2}}\right )}{a \sqrt{b \sqrt{b^2-4 a c}-2 c (a+c)+b^2}}-\frac{\tanh ^{-1}(\cos (x))}{a} \]

Antiderivative was successfully verified.

[In]

Int[Csc[x]/(a + b*Sin[x] + c*Sin[x]^2),x]

[Out]

-((Sqrt[2]*c*(1 + b/Sqrt[b^2 - 4*a*c])*ArcTan[(2*c + (b - Sqrt[b^2 - 4*a*c])*Tan[x/2])/(Sqrt[2]*Sqrt[b^2 - 2*c
*(a + c) - b*Sqrt[b^2 - 4*a*c]])])/(a*Sqrt[b^2 - 2*c*(a + c) - b*Sqrt[b^2 - 4*a*c]])) - (Sqrt[2]*c*(1 - b/Sqrt
[b^2 - 4*a*c])*ArcTan[(2*c + (b + Sqrt[b^2 - 4*a*c])*Tan[x/2])/(Sqrt[2]*Sqrt[b^2 - 2*c*(a + c) + b*Sqrt[b^2 -
4*a*c]])])/(a*Sqrt[b^2 - 2*c*(a + c) + b*Sqrt[b^2 - 4*a*c]]) - ArcTanh[Cos[x]]/a

Rule 3256

Int[sin[(d_.) + (e_.)*(x_)]^(m_.)*((a_.) + (b_.)*sin[(d_.) + (e_.)*(x_)]^(n_.) + (c_.)*sin[(d_.) + (e_.)*(x_)]
^(n2_.))^(p_), x_Symbol] :> Int[ExpandTrig[sin[d + e*x]^m*(a + b*sin[d + e*x]^n + c*sin[d + e*x]^(2*n))^p, x],
 x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[n2, 2*n] && NeQ[b^2 - 4*a*c, 0] && IntegersQ[m, n, p]

Rule 3770

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3292

Int[((A_) + (B_.)*sin[(d_.) + (e_.)*(x_)])/((a_.) + (b_.)*sin[(d_.) + (e_.)*(x_)] + (c_.)*sin[(d_.) + (e_.)*(x
_)]^2), x_Symbol] :> Module[{q = Rt[b^2 - 4*a*c, 2]}, Dist[B + (b*B - 2*A*c)/q, Int[1/(b + q + 2*c*Sin[d + e*x
]), x], x] + Dist[B - (b*B - 2*A*c)/q, Int[1/(b - q + 2*c*Sin[d + e*x]), x], x]] /; FreeQ[{a, b, c, d, e, A, B
}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 2660

Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = FreeFactors[Tan[(c + d*x)/2], x]}, Dis
t[(2*e)/d, Subst[Int[1/(a + 2*b*e*x + a*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}, x] &&
 NeQ[a^2 - b^2, 0]

Rule 618

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 204

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> -Simp[ArcTan[(Rt[-b, 2]*x)/Rt[-a, 2]]/(Rt[-a, 2]*Rt[-b, 2]), x] /
; FreeQ[{a, b}, x] && PosQ[a/b] && (LtQ[a, 0] || LtQ[b, 0])

Rubi steps

\begin{align*} \int \frac{\csc (x)}{a+b \sin (x)+c \sin ^2(x)} \, dx &=\int \left (\frac{\csc (x)}{a}+\frac{-b-c \sin (x)}{a \left (a+b \sin (x)+c \sin ^2(x)\right )}\right ) \, dx\\ &=\frac{\int \csc (x) \, dx}{a}+\frac{\int \frac{-b-c \sin (x)}{a+b \sin (x)+c \sin ^2(x)} \, dx}{a}\\ &=-\frac{\tanh ^{-1}(\cos (x))}{a}-\frac{\left (c \left (1-\frac{b}{\sqrt{b^2-4 a c}}\right )\right ) \int \frac{1}{b+\sqrt{b^2-4 a c}+2 c \sin (x)} \, dx}{a}-\frac{\left (c \left (1+\frac{b}{\sqrt{b^2-4 a c}}\right )\right ) \int \frac{1}{b-\sqrt{b^2-4 a c}+2 c \sin (x)} \, dx}{a}\\ &=-\frac{\tanh ^{-1}(\cos (x))}{a}-\frac{\left (2 c \left (1-\frac{b}{\sqrt{b^2-4 a c}}\right )\right ) \operatorname{Subst}\left (\int \frac{1}{b+\sqrt{b^2-4 a c}+4 c x+\left (b+\sqrt{b^2-4 a c}\right ) x^2} \, dx,x,\tan \left (\frac{x}{2}\right )\right )}{a}-\frac{\left (2 c \left (1+\frac{b}{\sqrt{b^2-4 a c}}\right )\right ) \operatorname{Subst}\left (\int \frac{1}{b-\sqrt{b^2-4 a c}+4 c x+\left (b-\sqrt{b^2-4 a c}\right ) x^2} \, dx,x,\tan \left (\frac{x}{2}\right )\right )}{a}\\ &=-\frac{\tanh ^{-1}(\cos (x))}{a}+\frac{\left (4 c \left (1-\frac{b}{\sqrt{b^2-4 a c}}\right )\right ) \operatorname{Subst}\left (\int \frac{1}{4 \left (4 c^2-\left (b+\sqrt{b^2-4 a c}\right )^2\right )-x^2} \, dx,x,4 c+2 \left (b+\sqrt{b^2-4 a c}\right ) \tan \left (\frac{x}{2}\right )\right )}{a}+\frac{\left (4 c \left (1+\frac{b}{\sqrt{b^2-4 a c}}\right )\right ) \operatorname{Subst}\left (\int \frac{1}{-8 \left (b^2-2 c (a+c)-b \sqrt{b^2-4 a c}\right )-x^2} \, dx,x,4 c+2 \left (b-\sqrt{b^2-4 a c}\right ) \tan \left (\frac{x}{2}\right )\right )}{a}\\ &=-\frac{\sqrt{2} c \left (1+\frac{b}{\sqrt{b^2-4 a c}}\right ) \tan ^{-1}\left (\frac{2 c+\left (b-\sqrt{b^2-4 a c}\right ) \tan \left (\frac{x}{2}\right )}{\sqrt{2} \sqrt{b^2-2 c (a+c)-b \sqrt{b^2-4 a c}}}\right )}{a \sqrt{b^2-2 c (a+c)-b \sqrt{b^2-4 a c}}}-\frac{\sqrt{2} c \left (1-\frac{b}{\sqrt{b^2-4 a c}}\right ) \tan ^{-1}\left (\frac{2 c+\left (b+\sqrt{b^2-4 a c}\right ) \tan \left (\frac{x}{2}\right )}{\sqrt{2} \sqrt{b^2-2 c (a+c)+b \sqrt{b^2-4 a c}}}\right )}{a \sqrt{b^2-2 c (a+c)+b \sqrt{b^2-4 a c}}}-\frac{\tanh ^{-1}(\cos (x))}{a}\\ \end{align*}

Mathematica [C]  time = 1.31748, size = 306, normalized size = 1.25 \[ -\frac{\frac{c \left (\sqrt{4 a c-b^2}-i b\right ) \tan ^{-1}\left (\frac{2 c+\tan \left (\frac{x}{2}\right ) \left (b-i \sqrt{4 a c-b^2}\right )}{\sqrt{2} \sqrt{-i b \sqrt{4 a c-b^2}-2 c (a+c)+b^2}}\right )}{\sqrt{2 a c-\frac{b^2}{2}} \sqrt{-i b \sqrt{4 a c-b^2}-2 c (a+c)+b^2}}+\frac{c \left (\sqrt{4 a c-b^2}+i b\right ) \tan ^{-1}\left (\frac{2 c+\tan \left (\frac{x}{2}\right ) \left (b+i \sqrt{4 a c-b^2}\right )}{\sqrt{2} \sqrt{i b \sqrt{4 a c-b^2}-2 c (a+c)+b^2}}\right )}{\sqrt{2 a c-\frac{b^2}{2}} \sqrt{i b \sqrt{4 a c-b^2}-2 c (a+c)+b^2}}-\log \left (\sin \left (\frac{x}{2}\right )\right )+\log \left (\cos \left (\frac{x}{2}\right )\right )}{a} \]

Antiderivative was successfully verified.

[In]

Integrate[Csc[x]/(a + b*Sin[x] + c*Sin[x]^2),x]

[Out]

-(((c*((-I)*b + Sqrt[-b^2 + 4*a*c])*ArcTan[(2*c + (b - I*Sqrt[-b^2 + 4*a*c])*Tan[x/2])/(Sqrt[2]*Sqrt[b^2 - 2*c
*(a + c) - I*b*Sqrt[-b^2 + 4*a*c]])])/(Sqrt[-b^2/2 + 2*a*c]*Sqrt[b^2 - 2*c*(a + c) - I*b*Sqrt[-b^2 + 4*a*c]])
+ (c*(I*b + Sqrt[-b^2 + 4*a*c])*ArcTan[(2*c + (b + I*Sqrt[-b^2 + 4*a*c])*Tan[x/2])/(Sqrt[2]*Sqrt[b^2 - 2*c*(a
+ c) + I*b*Sqrt[-b^2 + 4*a*c]])])/(Sqrt[-b^2/2 + 2*a*c]*Sqrt[b^2 - 2*c*(a + c) + I*b*Sqrt[-b^2 + 4*a*c]]) + Lo
g[Cos[x/2]] - Log[Sin[x/2]])/a)

________________________________________________________________________________________

Maple [B]  time = 0.17, size = 849, normalized size = 3.5 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(csc(x)/(a+b*sin(x)+c*sin(x)^2),x)

[Out]

-4/(4*a*c-b^2)/(4*c*a-2*b^2+2*b*(-4*a*c+b^2)^(1/2)+4*a^2)^(1/2)*arctan((-2*a*tan(1/2*x)+(-4*a*c+b^2)^(1/2)-b)/
(4*c*a-2*b^2+2*b*(-4*a*c+b^2)^(1/2)+4*a^2)^(1/2))*(-4*a*c+b^2)^(1/2)*c+2/a/(4*a*c-b^2)/(4*c*a-2*b^2+2*b*(-4*a*
c+b^2)^(1/2)+4*a^2)^(1/2)*arctan((-2*a*tan(1/2*x)+(-4*a*c+b^2)^(1/2)-b)/(4*c*a-2*b^2+2*b*(-4*a*c+b^2)^(1/2)+4*
a^2)^(1/2))*(-4*a*c+b^2)^(1/2)*b^2+8/(4*a*c-b^2)/(4*c*a-2*b^2+2*b*(-4*a*c+b^2)^(1/2)+4*a^2)^(1/2)*arctan((-2*a
*tan(1/2*x)+(-4*a*c+b^2)^(1/2)-b)/(4*c*a-2*b^2+2*b*(-4*a*c+b^2)^(1/2)+4*a^2)^(1/2))*b*c-2/a/(4*a*c-b^2)/(4*c*a
-2*b^2+2*b*(-4*a*c+b^2)^(1/2)+4*a^2)^(1/2)*arctan((-2*a*tan(1/2*x)+(-4*a*c+b^2)^(1/2)-b)/(4*c*a-2*b^2+2*b*(-4*
a*c+b^2)^(1/2)+4*a^2)^(1/2))*b^3-4/(4*a*c-b^2)/(4*c*a-2*b^2-2*b*(-4*a*c+b^2)^(1/2)+4*a^2)^(1/2)*arctan((2*a*ta
n(1/2*x)+b+(-4*a*c+b^2)^(1/2))/(4*c*a-2*b^2-2*b*(-4*a*c+b^2)^(1/2)+4*a^2)^(1/2))*(-4*a*c+b^2)^(1/2)*c+2/a/(4*a
*c-b^2)/(4*c*a-2*b^2-2*b*(-4*a*c+b^2)^(1/2)+4*a^2)^(1/2)*arctan((2*a*tan(1/2*x)+b+(-4*a*c+b^2)^(1/2))/(4*c*a-2
*b^2-2*b*(-4*a*c+b^2)^(1/2)+4*a^2)^(1/2))*(-4*a*c+b^2)^(1/2)*b^2-8/(4*a*c-b^2)/(4*c*a-2*b^2-2*b*(-4*a*c+b^2)^(
1/2)+4*a^2)^(1/2)*arctan((2*a*tan(1/2*x)+b+(-4*a*c+b^2)^(1/2))/(4*c*a-2*b^2-2*b*(-4*a*c+b^2)^(1/2)+4*a^2)^(1/2
))*b*c+2/a/(4*a*c-b^2)/(4*c*a-2*b^2-2*b*(-4*a*c+b^2)^(1/2)+4*a^2)^(1/2)*arctan((2*a*tan(1/2*x)+b+(-4*a*c+b^2)^
(1/2))/(4*c*a-2*b^2-2*b*(-4*a*c+b^2)^(1/2)+4*a^2)^(1/2))*b^3+1/a*ln(tan(1/2*x))

________________________________________________________________________________________

Maxima [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)/(a+b*sin(x)+c*sin(x)^2),x, algorithm="maxima")

[Out]

Timed out

________________________________________________________________________________________

Fricas [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)/(a+b*sin(x)+c*sin(x)^2),x, algorithm="fricas")

[Out]

Timed out

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{\csc{\left (x \right )}}{a + b \sin{\left (x \right )} + c \sin ^{2}{\left (x \right )}}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)/(a+b*sin(x)+c*sin(x)**2),x)

[Out]

Integral(csc(x)/(a + b*sin(x) + c*sin(x)**2), x)

________________________________________________________________________________________

Giac [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{\csc \left (x\right )}{c \sin \left (x\right )^{2} + b \sin \left (x\right ) + a}\,{d x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)/(a+b*sin(x)+c*sin(x)^2),x, algorithm="giac")

[Out]

integrate(csc(x)/(c*sin(x)^2 + b*sin(x) + a), x)